package com.example.springboot.mapper;

import com.example.springboot.entity.User;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {
    /**
     * 根据手机号查询用户
     *
     * @param phoneNumber
     * @return
     */
    User findByPhoneNumber(String phoneNumber);

    /**
     * 插入用户
     *
     * @param user
     */
    void insertUser(User user);

    /**
     * 更新用户
     *
     * @param user
     */

    void updateUserPassword(User user);



    Integer getUserIdByUsername(String username);

    void updateAvatar(@Param("userId") Integer userId, @Param("avatarUrl") String avatarUrl);
    void updateUsername(@Param("userId") Integer userId, @Param("username") String username);
    Page<User> getAllUsers();

    void deleteUser(Integer userId);

    void addUser(User user);

    void updateUser(User user);

    User getUserById(Integer userId);

    Page<User> findByQuery(String query);

    String findRoleByUsername(String username);

}
